﻿Imports System.IO

Public Class cegeps
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try

            Using sr As New StreamReader(Me.MapPath("cegeps.txt"))

                Dim ligne As String

                Do
                    ligne = sr.ReadLine()

                    If Not (ligne Is Nothing) Then

                        Dim ligneSplitted As String()

                        ligneSplitted = ligne.Split(";")

                        Dim nomCegep As String = ligneSplitted(0)
                        Dim lien As String = ligneSplitted(1)

                        Dim hyperLink As New HyperLink

                        hyperLink.Text = nomCegep
                        hyperLink.NavigateUrl = lien
                        hyperLink.Target = "_blank"

                        pLiens.Controls.Add(hyperLink)

                        Dim lit As New Literal
                        lit.Text = "<br />"

                        pLiens.Controls.Add(lit)

                    End If

                Loop Until ligne Is Nothing

            End Using

        Catch ex As Exception
            lError.Text = "Le Fichier est introuvable"
        End Try
    End Sub

End Class